package com.tdengine.tdengine;

import com.taosdata.jdbc.TSDBDriver;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.Properties;

public class MainConnect {

    public static void main(String[] args) throws Exception {
        String jdbcUrl = "jdbc:TAOS://121.224.115.37:30719?user=root&password=taosdata";
        Properties connProps = new Properties();
        connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
        connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
        connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
        Connection conn = DriverManager.getConnection(jdbcUrl, connProps);

        Statement stmt = conn.createStatement();
        stmt.executeUpdate("create database if not exists d11b");
        conn.close();
        System.out.println("Connected");
    }

}
